﻿using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using OfficeOpenXml;
using System.Xml;
using MoodleLoginDelayTest.WSMoodle;
using System.Reflection;
using System.Globalization;

namespace MoodleLoginDelayTest
{
    public partial class frmMLDRT : Form
    {
        /* Implementation guide
         * Create 1024 users in moodle
         * Gradually create 1024 courses and insert all user created in each course
         * Respect that structure:
         * Real[] Delay[{Added Courses}-1] = {Moodle delay while Login};
         * Moodle delay while login has calculated by a non-intrusive code inserction in the moodle login.php and retrivied by a http request
         */
        //const int ITERATIONS = 1024;
        const int ITERATIONS = 10;
        static string MoodleUrl = Properties.Settings.Default.MoodleURL;
        static string MoodleLoginUrl = Properties.Settings.Default.MoodleLoginURL;
        #region Variable Declarations
        Double[] Delay = new Double[ITERATIONS];
        Double[] remoteDelay = new Double[ITERATIONS];
        String[] UserIds = new String[ITERATIONS];
        String[] CourseIds = new String[ITERATIONS];
        #endregion

       
        private void Form1_Load(object sender, EventArgs e)
        {
            DoTestsThread = new Thread(new ThreadStart(DoTests));
            DoTestsThread.CurrentCulture = new CultureInfo("en-US");
            WSMoodle.MoodleWS _ms = new WSMoodle.MoodleWS();
            lblNumUsers.Text = ITERATIONS.ToString();
            lblNumCourses.Text = ITERATIONS.ToString();
            lblNumCoursesClr.Text = ITERATIONS.ToString();
            lblCoursesToAddStudent.Text = ITERATIONS.ToString();
        }

        #region Delegate Related Functions
        
        #region Delegates
        delegate void pbUsersInitDelegate(int i);
        delegate void pbUsersUpdateDelegate(int i);
        delegate void pbCoursesInitDelegate(int i);
        delegate void pbCoursesUpdateDelegate(int i);
        delegate void pbCurrentCourseInitDelegate(int i);
        delegate void pbCurrentCourseUpdateDelegate(int i);
        delegate void pbCoursesClearedInitDelegate(int i);
        delegate void pbCoursesClearedUpdateDelegate(int i);
       
        delegate void AddToLB1Delegate(string value, bool newLine);
        delegate void ResetButtonsDelegate();
        #endregion
        
        #region Functions
        private void pbUsersInit(int i)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new pbUsersInitDelegate(pbUsersInit), i);
            }
            else
            {
                pbUsers.Maximum = i;
                pbUsers.Value = 0;
            }
        }

        private void pbUsersUpdate(int i)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new pbUsersUpdateDelegate(pbUsersUpdate), i);
            }
            else
            {
                pbUsers.Value = i;
                lblCreatedUsers.Text = i.ToString();
            }
        }

        private void pbCoursesInit(int i)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new pbCoursesInitDelegate(pbCoursesInit), i);
            }
            else
            {
                pbCourses.Maximum = i;
                pbCourses.Value = 0;
            }
        }

        private void pbCoursesUpdate(int i)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new pbCoursesUpdateDelegate(pbCoursesUpdate), i);
            }
            else
            {
                pbCourses.Value = i;
                lblCreatedCourses.Text = i.ToString();
            }
        }

        private void pbCurrentCourseInit(int i)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new pbCurrentCourseInitDelegate(pbCurrentCourseInit), i);
            }
            else
            {
                pbCurrentCourse.Maximum = i;
                pbCurrentCourse.Value = 0;
            }
        }

        private void pbCurrentCourseUpdate(int i)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new pbCurrentCourseUpdateDelegate(pbCurrentCourseUpdate), i);
            }
            else
            {
                pbCurrentCourse.Value = i;
                lblCurrentCourse.Text = i.ToString();
            }
        }

        private void pbCoursesClearedInit(int i)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new pbCoursesClearedInitDelegate(pbCoursesClearedInit), i);
            }
            else
            {
                pbCoursesCleared.Maximum = i;
                pbCoursesCleared.Value = 0;
            }
        }

        private void pbCoursesClearedUpdate(int i)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new pbCoursesClearedUpdateDelegate(pbCoursesClearedUpdate), i);
            }
            else
            {
                pbCoursesCleared.Value = i;
                lblCoursesCleared.Text = i.ToString();
            }
        }

        private void AddToLB1(string value, bool newLine)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new AddToLB1Delegate(AddToLB1), value, newLine);
            }
            else
            {
                int Count = lbxStatus.Items.Count;
                if ((Count > 0) && !newLine)
                    lbxStatus.Items[Count - 1] += value;
                else
                {
                    lbxStatus.Items.Add(value);
                    lbxStatus.SelectedIndex = lbxStatus.Items.Count - 1;
                }
            }
        }

        private void ResetButtons()
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new ResetButtonsDelegate(ResetButtons));
            }
            else
            {
                btStart.Text = "Start";
                btAbort.Enabled = false;
                btOpenXSLX.Enabled = true;
            }
        }
        #endregion
        
        #endregion

        private WSMoodle.MoodleWS _ms = new WSMoodle.MoodleWS();

        private void DoTests()
        {
            try
            {
                string UsernameADM = "admin";
                string PasswordADM = "admin";
                loginReturn _loginReturn = _ms.login(UsernameADM, PasswordADM);
                string client = _loginReturn.client;
                string sessionkey = _loginReturn.sessionkey;
                if (client != "")
                {

                    Int16 CurrentUserId = 0;
                    pbUsersInit(ITERATIONS);
                    getUsersReturn currentUsersReturn = new getUsersReturn();
                    for (int UserIndex = 0; UserIndex.CompareTo(ITERATIONS) < 0; UserIndex++)
                    {
                        pbUsersUpdate(UserIndex + 1);
                        AddToLB1("Start testUser" + UserIndex.ToString() + " find proccess...", true);
                        currentUsersReturn = _ms.get_user(client, sessionkey, "testUser" + UserIndex.ToString(), "username");
                        if (currentUsersReturn.users[0].error == "no match found for username= testUser" + UserIndex.ToString())
                        {
                            AddToLB1("Not found", false);
                            AddToLB1("Start testUser" + UserIndex.ToString() + " creation proccess...", true);
                            if ((CurrentUserId = (Int16)AddUserToMoodle(UserIndex)) == 0)
                            {
                                AddToLB1("Error", false);
                            }
                            else
                            {
                                AddToLB1("Ok", false);
                            }
                        }
                        else if (currentUsersReturn.users[0].error == "")
                        {
                            AddToLB1("Ok", false);
                            CurrentUserId = Convert.ToInt16(currentUsersReturn.users[0].id);
                        }
                        else
                        {
                            AddToLB1("Error", false);
                        }
                        UserIds[UserIndex] = CurrentUserId.ToString();
                    }

                    Int16 CurrentCourseId = 0;
                    pbCoursesInit(ITERATIONS);
                    getCoursesReturn currentCoursesReturn = new getCoursesReturn();
                    for (int CourseIndex = 0; CourseIndex.CompareTo(ITERATIONS) < 0; CourseIndex++)
                    {
                        pbCoursesUpdate(CourseIndex + 1);
                        AddToLB1("Start testCourse" + CourseIndex.ToString() + " find proccess...", true);
                        currentCoursesReturn = _ms.get_course(client, sessionkey, "testCourse" + CourseIndex.ToString(), "shortname");
                        if (currentCoursesReturn.courses[0].error == "no match for shortname = testCourse" + CourseIndex.ToString())
                        {
                            AddToLB1("Not found", false);
                            AddToLB1("Start testCourse" + CourseIndex.ToString() + " creation proccess...", true);
                            if ((CurrentCourseId = (Int16)AddCourseToMoodle(CourseIndex)) == 0)
                            {
                                AddToLB1("Error", false);
                            }
                            else
                            {
                                AddToLB1("Ok", false);
                            }
                        }
                        else if (currentCoursesReturn.courses[0].error == "")
                        {
                            AddToLB1("Ok", false);
                            CurrentCourseId = Convert.ToInt16(currentCoursesReturn.courses[0].id);
                        }
                        else
                        {
                            AddToLB1("Error", false);
                        }
                        CourseIds[CourseIndex] = CurrentCourseId.ToString();
                    }

                    pbCoursesClearedInit(ITERATIONS);
                    getUsersReturn courseToClearReturn = new getUsersReturn();
                    for (int courseToClearIndex = 0; courseToClearIndex.CompareTo(ITERATIONS) < 0; courseToClearIndex++)
                    {
                        pbCoursesClearedUpdate(courseToClearIndex + 1);
                        AddToLB1("Start testCourse" + courseToClearIndex.ToString() + " find students proccess...", true);
                        try
                        {
                            courseToClearReturn = _ms.get_students(client, sessionkey, "testCourse" + courseToClearIndex.ToString(), "shortname");
                        }
                        catch (Exception e)
                        {
                            AddToLB1("Error", false);
                            throw e;
                        }

                        if (courseToClearReturn.users[0].error != "no users in course shortname=testCourse" + courseToClearIndex.ToString() + " with role 5")
                        {
                            AddToLB1("Ok", false);
                            AddToLB1("Start testCourse" + courseToClearIndex.ToString() + " clear students proccess...", true);
                            String[] returnedStudentIds = new String[courseToClearReturn.users.Length];
                            for (int returnedStudentsIndex = 0; returnedStudentsIndex.CompareTo(courseToClearReturn.users.Length) < 0; returnedStudentsIndex++)
                            {
                                returnedStudentIds[returnedStudentsIndex] = courseToClearReturn.users[returnedStudentsIndex].id;
                            }
                            unenrolStudentsReturn clearStudentsReturn = _ms.unenrol_students(client, sessionkey, CourseIds[courseToClearIndex], returnedStudentIds, "id");
                            if (clearStudentsReturn.error == "")
                            {
                                AddToLB1("Ok", false);
                            }
                            else
                            {
                                AddToLB1("Error", false);
                            }
                        }
                        else
                        {
                            AddToLB1("No Students", false);
                        }
                    }

                    DateTime startDateTime;
                    pbCurrentCourseInit(ITERATIONS);
                    getUsersReturn currentCourseReturn = new getUsersReturn();
                    for (int CurrentCourseIndex = 0; CurrentCourseIndex.CompareTo(ITERATIONS) < 0; CurrentCourseIndex++)
                    {
                        pbCurrentCourseUpdate(CurrentCourseIndex + 1);
                        AddToLB1("Start testCourse" + CurrentCourseIndex.ToString() + " add students proccess...", true);
                        enrolStudentsReturn studentsReturn = _ms.enrol_students(client, sessionkey, CourseIds[CurrentCourseIndex], UserIds, "id");
                        if (studentsReturn.students.Length.Equals(UserIds.Length))
                        {
                            AddToLB1("Ok", false);
                            if(CurrentCourseIndex.Equals(ITERATIONS-1))
                                AddToLB1("Wait a moment...", true);
                        }
                        else
                        {
                            AddToLB1("Error", false);
                            AddToLB1("\tOnly " + studentsReturn.students.Length.ToString() + " students added to course.", true);
                        }
                        startDateTime = DateTime.Now;
                        Delay[CurrentCourseIndex] = DoMoodleLogin("testUser0", "testPass0");
                        remoteDelay[CurrentCourseIndex] = DateTime.Now.Subtract(startDateTime).TotalMilliseconds/1000;
                        pbCurrentCourseUpdate(CurrentCourseIndex + 1);
                    }
                    _ms.logout(client, sessionkey);
                    FileInfo resultSheet = new FileInfo(@".\results.xlsx");
                    if (resultSheet.Exists)
                    {
                        resultSheet.Delete();
                        resultSheet = new FileInfo(@".\results.xlsx");
                    }

                    using (ExcelPackage xlPackage = new ExcelPackage(resultSheet))
                    {
                        xlPackage.DebugMode = false;
                        ExcelWorksheet worksheet = xlPackage.Workbook.Worksheets.Add("MSU Login Delay");
                        for (int i = 0; i < ITERATIONS; i++)
                        {
                            worksheet.Cell(1, i + 1).Value = (i + 1).ToString();
                            worksheet.Cell(2, i + 1).Value = Delay[i].ToString();
                            worksheet.Cell(3, i + 1).Value = remoteDelay[i].ToString();
                        }
                        xlPackage.Save();
                    }
                    AddToLB1("Done", false);
                }
                else
                {
                    AddToLB1("Connection Error", true);
                }
            }
            catch (Exception err)
            {
                String typeStr = err.GetType().ToString();
                switch (typeStr)
                {
                    case "System.Net.WebException":
                        AddToLB1("Connection Error: " + err.Message, true);
                        break;
                    default:
                        AddToLB1("A Error has ocurred: " + err.Message, true);
                        break;
                }
                FileInfo resultSheet = new FileInfo(@".\~results.xlsx");
                if (resultSheet.Exists)
                {
                    resultSheet.Delete();
                    resultSheet = new FileInfo(@".\~results.xlsx");
                }

                using (ExcelPackage xlPackage = new ExcelPackage(resultSheet))
                {
                    xlPackage.DebugMode = false;
                    ExcelWorksheet worksheet = xlPackage.Workbook.Worksheets.Add("MSU Login Delay");
                    for (int i = 0; i < ITERATIONS; i++)
                    {                      
                        worksheet.Cell(1, i + 1).Value = (i + 1).ToString();
                        worksheet.Cell(2, i + 1).Value = Delay[i].ToString();
                        worksheet.Cell(3, i + 1).Value = remoteDelay[i].ToString();
                    }
                    xlPackage.Save();
                }
            }
            finally 
            {
                ResetButtons();
            }            
        }

        public frmMLDRT()
        {
            InitializeComponent();
        }

        private void tabPage2_Click(object sender, EventArgs e)
        {

        }
        
        private void button1_Click(object sender, EventArgs e)
        {
            if (btStart.Text.Equals("Start"))
            {
                DoTestsThread.Start();
                btStart.Text = "Suspend";
                btAbort.Enabled = true;
            }
            else if (btStart.Text.Equals("Suspend"))
            {
                DoTestsThread.Suspend();
                btStart.Text = "Resume";
            }
            else if (btStart.Text.Equals("Resume"))
            {
                DoTestsThread.Resume();
                btStart.Text = "Suspend";
            }    
        }

        static double DoMoodleLogin(string user, string password)
        {
            #region GetNewCookiesFromMoodle

            HttpWebRequest RetrieveCookieRequest = (HttpWebRequest)WebRequest.Create(MoodleUrl);
                RetrieveCookieRequest.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.2; pt-BR; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12";
                RetrieveCookieRequest.CookieContainer = new CookieContainer();
                HttpWebResponse RetrieveCookieResponse = (HttpWebResponse)RetrieveCookieRequest.GetResponse();
                CookieCollection RetrieveCookieCollection = RetrieveCookieResponse.Cookies;
                CookieContainer RetrievedCookieContainer = new CookieContainer();
                for (int i = 0; i < RetrieveCookieCollection.Count; i++)
                {
                    RetrievedCookieContainer.Add(RetrieveCookieCollection[i]);
                }

            RetrieveCookieResponse.Close();
            #endregion

            #region DoMoodleLoginAndRetrieveTime
            HttpWebRequest DoLoginRequest = (HttpWebRequest)WebRequest.Create(MoodleLoginUrl);
                DoLoginRequest.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.2; pt-BR; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12";
                DoLoginRequest.CookieContainer = RetrievedCookieContainer;
                DoLoginRequest.Method = "POST";
                DoLoginRequest.ContentType = "application/x-www-form-urlencoded";
                string DoLoginRequestArguments = "username=" + user + "&password=" + password + "&testcookies=1";
                DoLoginRequest.ContentLength = DoLoginRequestArguments.Length;
                StreamWriter DoLoginRequestStreamWriter = new StreamWriter(DoLoginRequest.GetRequestStream(), System.Text.Encoding.ASCII);
                DoLoginRequestStreamWriter.Write(DoLoginRequestArguments);
                DoLoginRequestStreamWriter.Close();
                HttpWebResponse DoLoginResponse = (HttpWebResponse)DoLoginRequest.GetResponse();
                StreamReader DoLoginResponseStreamReader = new StreamReader(DoLoginResponse.GetResponseStream());
                string DoLoginResponseString = DoLoginResponseStreamReader.ReadToEnd();

                Regex regex = new Regex("<b>.*</b>");
                string output = regex.Match(DoLoginResponseString).ToString();
                output = output.Replace("<b>", null);
                output = output.Replace("</b>", null);

                DoLoginResponseStreamReader.Close();
                DoLoginResponse.Close();

            #endregion

            return Convert.ToDouble(output, new System.Globalization.CultureInfo("en-US"));
        }

        static int AddUserToMoodle(int index)
        {
            string UsernameADM = "admin";
            string PasswordADM = "admin";

            string username = "testUser" + index.ToString();
            string password = "testPass" + index.ToString();
            string firstname = "testFirstName" + index.ToString();
            string lastname = "testLastName" + index.ToString();
            string email = "testEmail" + index.ToString() + "@test.com";

            WSMoodle.MoodleWS _ms = new WSMoodle.MoodleWS();
            WSMoodle.loginReturn _loginReturn;

            try
            {
                _loginReturn = _ms.login(UsernameADM, PasswordADM);

                string client = _loginReturn.client;
                string sessionkey = _loginReturn.sessionkey;

                if (client == "")
                    return 0;
                else
                {
                    editUsersInput _editUsersInput = new MoodleLoginDelayTest.WSMoodle.editUsersInput();
                    _editUsersInput.users = new userDatum[1];
                    _editUsersInput.users[0] = new userDatum();

                    _editUsersInput.users[0].action = "Add";
                    _editUsersInput.users[0].confirmed = "1";
                    _editUsersInput.users[0].auth = "manual";
                    _editUsersInput.users[0].deleted = "0";
                    _editUsersInput.users[0].idnumber = "";
                    _editUsersInput.users[0].username = username;
                    _editUsersInput.users[0].password = CalculateMD5Hash(password);
                    _editUsersInput.users[0].firstname = firstname;
                    _editUsersInput.users[0].lastname = lastname;
                    _editUsersInput.users[0].email = email;
                    _editUsersInput.users[0].city = "Bauru";
                    _editUsersInput.users[0].country = "BR";
                    _editUsersInput.users[0].lang = "en_utf8";
                    _editUsersInput.users[0].mnethostid = "1";

                    editUsersOutput _editUsersOutput = _ms.edit_users(client, sessionkey, _editUsersInput);
                    _ms.logout(client, sessionkey);

                    if (_editUsersOutput.users[0].error != "")
                        throw new Exception(_editUsersOutput.users[0].error);
                    else
                        return Convert.ToInt16(_editUsersOutput.users[0].id);
                }
            }
            catch (Exception ex)
            {
                return 0;
            }
        }

        static int AddCourseToMoodle(int index)
        {
            WSMoodle.MoodleWS _ms = new WSMoodle.MoodleWS();
            
            string UsernameADM = "admin";
            string PasswordADM = "admin";
            loginReturn _loginReturn = _ms.login(UsernameADM, PasswordADM);
            string client = _loginReturn.client;
            string sessionkey = _loginReturn.sessionkey;

            if (client == "")
                return 0;
            else
            {
                try
                {
                    editCoursesInput _editCoursesInput = new MoodleLoginDelayTest.WSMoodle.editCoursesInput();
                    _editCoursesInput.courses = new courseDatum[1];
                    _editCoursesInput.courses[0] = new courseDatum();
                    _editCoursesInput.courses[0].action = "Add";
                    _editCoursesInput.courses[0].category = "1";
                    _editCoursesInput.courses[0].fullname = "TEST Course " + index.ToString();
                    _editCoursesInput.courses[0].shortname = "testCourse" + index.ToString();
                    _editCoursesInput.courses[0].format = "week";
                    _editCoursesInput.courses[0].showgrades = "1";
                    _editCoursesInput.courses[0].newsitems = "5";
                    _editCoursesInput.courses[0].visible = "1";
                    editCoursesOutput _editCoursesOutput = _ms.edit_courses(client, sessionkey, _editCoursesInput);
                    _ms.logout(client, sessionkey);
                    if (_editCoursesOutput.courses[0].error != "")
                        throw new Exception(_editCoursesOutput.courses[0].error);
                    else
                        return Convert.ToInt16(_editCoursesOutput.courses[0].id);
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }

        static string CalculateMD5Hash(string input)
        {
            MD5CryptoServiceProvider x = new MD5CryptoServiceProvider();
            byte[] bs = Encoding.UTF8.GetBytes(input);
            bs = x.ComputeHash(bs);
            StringBuilder s = new StringBuilder();
            foreach (byte b in bs)
            {
                s.Append(b.ToString("x2").ToLower());
            }
            string password = s.ToString();
            return password;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            btStart.Text = "Start";
            btAbort.Enabled = false;
            DoTestsThread.Abort();
        }

        List<List<double>> LocalResults;
        List<List<double>> RemoteResults;
        Thread DoTestsThread;

        private void LB1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click_1(object sender, EventArgs e)
        {

            FileInfo resultSheet = new FileInfo(@".\results.xlsx");
            if (resultSheet.Exists)
            {
                resultSheet.Delete();
                resultSheet = new FileInfo(@".\results.xlsx");
            }

            using (ExcelPackage xlPackage = new ExcelPackage(resultSheet))
            {
                xlPackage.DebugMode = false;
                for (int i = 0; i < LocalResults.Count; i++)
                {
                    ExcelWorksheet worksheet = xlPackage.Workbook.Worksheets.Add(Convert.ToInt16(Math.Pow(2, i)).ToString() + ((i.Equals(0)) ? " User" : " Users"));
                    for (int j = 0; j < LocalResults[i].Count; j++)
                    {
                        worksheet.Cell(j + 1, 1).Value = (j + 1).ToString();
                        worksheet.Cell(j + 1, 2).Value = LocalResults[i][j].ToString();
                    }
                    worksheet.Cell(1, 3).Formula = string.Format("SUM({0}:{1})/{2}", worksheet.Cell(1, 2).CellAddress, worksheet.Cell(LocalResults[i].Count, 2).CellAddress, LocalResults[i].Count.ToString());
                }
                xlPackage.Save();
            }

            FileInfo resultSheetRemote = new FileInfo(@".\results_remote.xlsx");
            if (resultSheetRemote.Exists)
            {
                resultSheetRemote.Delete();
                resultSheetRemote = new FileInfo(@".\results_remote.xlsx");
            }

            using (ExcelPackage xlPackageRemote = new ExcelPackage(resultSheetRemote))
            {
                xlPackageRemote.DebugMode = false;
                for (int i = 0; i < RemoteResults.Count; i++)
                {
                    ExcelWorksheet worksheetRemote = xlPackageRemote.Workbook.Worksheets.Add(Convert.ToInt16(Math.Pow(2, i)).ToString() + ((i.Equals(0)) ? " User" : " Users"));
                    for (int j = 0; j < RemoteResults[i].Count; j++)
                    {
                        worksheetRemote.Cell(j + 1, 1).Value = (j + 1).ToString();
                        worksheetRemote.Cell(j + 1, 2).Value = RemoteResults[i][j].ToString();
                    }
                    worksheetRemote.Cell(1, 3).Formula = string.Format("SUM({0}:{1})/{2}", worksheetRemote.Cell(1, 2).CellAddress, worksheetRemote.Cell(LocalResults[i].Count, 2).CellAddress, RemoteResults[i].Count.ToString());
                }
                xlPackageRemote.Save();
            }

        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }



        private void btOpenXSLX_Click(object sender, EventArgs e)
        {

        }

        private void lblTotalUsersToBeCreated_Click(object sender, EventArgs e)
        {

        }
    }
}
